package constants

type MsgCode int

const (
	OK 					MsgCode = 200
	PARAMETER_ERROR 	MsgCode = 4001
	REDIS_ERROR 		MsgCode = 4002
	NO_ITEM_AFFECTED 	MsgCode = 4003
	INNER_ERROR 		MsgCode = 4099
)

var message = map[int]string{

	200:  		"success",

	4001: 		"parameter error",
	4002: 		"server error",
	4003: 		"no item been affected",
	4099: 		"inner error",
}

// 消息编号
func (code MsgCode) GetCode() int {
	return int(code)
}

// 消息内容
func (code MsgCode) GetMessage() string {
	if v, ok := message[int(code)]; ok {
		return v
	}
	return ""
}

